package cn.wolfcode.luowowo.article.service.impl;

import cn.wolfcode.luowowo.article.domain.TouristDetail;
import cn.wolfcode.luowowo.article.mapper.TouristDetailMapper;
import cn.wolfcode.luowowo.article.service.ITouristDetailService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class TouristDetailServiceImpl implements ITouristDetailService {

    @Autowired
    private TouristDetailMapper touristDetailMapper;

    @Override
    public void saveOrUpdate(TouristDetail tourist) {
        if (tourist.getId() != null) {
            touristDetailMapper.updateByPrimaryKey(tourist);
        }else {
            touristDetailMapper.insert(tourist);
        }
    }

    @Override
    public TouristDetail get(Long id) {
        return touristDetailMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<TouristDetail> listAll() {
        return touristDetailMapper.selectAll();
    }

   
}
